package game;

import java.awt.Color;
import java.awt.Point;
import java.awt.event.MouseEvent;

public class Celda {
	private Color color;
	private Point posicion;
	private Runnable action;
		
	public static Color[] colores = {Color.red, Color.green, Color.blue, Color.yellow, Color.LIGHT_GRAY, Color.black, Color.white}; 
	public Celda(boolean b){
		if(b) this.setColor(colores.length);
		else this.setColor(colores.length-2);
		this.setPosicion(new Point(0, 0));
	}
	private void setColor(int length) {
		color = colores[(int) (Math.random()*length)];
	}
	public Color getColor() {
		return color;
	}
	public void setColor(Color color) {
		this.color = color;
	}
	public Point getPosicion() {
		return posicion;
	}
	public void setPosicion(Point posicion) {
		this.posicion = posicion;
	}
	public void perform(MouseEvent ev) {
		if(action != null)
			action.run();
	}
	public Runnable getAction() {
		return action;
	}
	public void setAction(Runnable action) {
		this.action = action;
	}
	public void setColor() {
		color = colores[(int) (Math.random()*colores.length)];
		
	}
}
